/*
 * @Description:
 * @Version: 2.0
 * @Autor: wsh
 * @Date: 2024-04-03 14:33:13
 * @LastEditors: uphldjx 1373577124@qq.com
 * @LastEditTime: 2024-05-23 10:13:35
 */
import { getAreaObj, uploadType } from '@/utils/util'
export const searchConfig = {
	inline: true,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '所属区域',
			prop: 'tableAreaName',
			type: 'AplidAreaSelect',
			span: 8,
		},
		{
			label: '承接单位名称',
			prop: 'orgHomeName',
			type: 'input',
			span: 8,
		},
		{
			label: '统一社会信用代码',
			prop: 'creditCode',
			type: 'input',
			span: 8,
		},
	],
}

export const tableConfig = {
	stripe: true,
	border: true,
	columns: [
		// { type: 'selection', reserveSelection: true },
		{ label: '所属区', prop: 'areaName' },
		{ label: '单位名称', prop: 'orgHomeName' },
		{ label: '统一社会信用代码', prop: 'creditCode' },
		{ label: '负责人', prop: 'contactUserName' },
		{ label: '联系方式', prop: 'contactUserPhone' },
		{
			label: '操作',
			prop: 'menu',
			width: 300,
			fixed: 'right',
		},
	],
}

export const api = {
	index: 'dpServiceOrgHome_page',
	// add: 'view_omProjectManagement_add',
}
export const baseConfig = {
	pageName: '承接单位-养老服务运营单位',
	dictcodes: [],
	rowKey: 'id',
	addLabel: '新增',
	tipLabel: 'sampleTime',
	exportMqTopic: '/ning/export/',
	api,
	auth: {
		...api,
	},
	paramsObj: {
		isWithAuth: 0,
	},
	menuBtn: [
		{
			icon: 'editor',
			label: '添加',
			type: 'primary',
			operate: 'add',
			// auth: api.add,
			auth: 'view_omProjectManagement_add',
			text: true,
			show: true,
		},
	],
	beforeOnLoadFormate: async (params) => {
		console.log(params, 'params')
		if (params.projectTimeBetween) {
			params.projectTimeBetween = params.projectTimeBetween.join(',')
		} else {
			params.projectTimeBetween = undefined
		}
		return new Promise((resolve, reject) => {
			const areaObj: any = getAreaObj(params.tableAreaName)
			resolve({
				...params,
				...areaObj,
				tableAreaName: undefined,
			})
		})
	},
	dialogConfig: {
		width: '55%',
	},
	searchConfig,
	tableConfig,
}
